package com.jn.entity;

import java.io.Serializable;
import java.util.concurrent.ConcurrentHashMap;

import com.jn.entity.transverter.Transverter;

public class BaseEntity extends ConcurrentHashMap<String,Object> implements Serializable{
	
	private static final long serialVersionUID = -5700514926019801009L;
	
	@SuppressWarnings("unchecked")
	public <T> T getV(String key){
		return (T) this.get(key);
	}
	
	@SuppressWarnings("unchecked")
	public <T> T getVByTransverter(String key, Transverter transverter){
		return (T) transverter.transverter(this.get(key));
	}
	
	public Boolean setKV(String key, Object value){
		clearV(key);
		if(this.put(key, value) != null){
			return true;
		}else{
			return false;
		}
	}
	
	public void clearV(String key){
		this.remove(key);
	}
	
}
